package cn.com.woxitech.dev.controller.mvc;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cn.com.woxitech.dev.common.Const;
import cn.com.woxitech.dev.common.EncryptionUtils;
import cn.com.woxitech.dev.common.StrUtils;
import cn.com.woxitech.dev.common.weixin.PayCommonUtil;
import cn.com.woxitech.dev.common.weixin.XMLUtil;
import cn.com.woxitech.dev.dao.gen.WmRoomMapper;
import cn.com.woxitech.dev.model.WeixinWebAccessToken;
import cn.com.woxitech.dev.model.gen.WmCatalog;
import cn.com.woxitech.dev.model.gen.WmLecture;
import cn.com.woxitech.dev.model.gen.WmLecturePage;
import cn.com.woxitech.dev.model.gen.WmRoom;
import cn.com.woxitech.dev.model.gen.WmRoomExample;
import cn.com.woxitech.dev.model.gen.WmUser;
import cn.com.woxitech.dev.service.CatalogService;
import cn.com.woxitech.dev.service.LecturePageService;
import cn.com.woxitech.dev.service.LectureService;
import cn.com.woxitech.dev.service.RoomService;
import cn.com.woxitech.dev.service.UserService;
import cn.com.woxitech.dev.service.WeixinService;

@Controller
public class TestMVCController {
	
	@Autowired 
	private WeixinService weixinService;

	@Autowired 
	private CatalogService catalogService;
	@Autowired 
	private UserService userService;
	
	@Autowired
	private RoomService roomService;
	@Autowired
	private LectureService lectureService;
	@Autowired
	private LecturePageService lecturePageService;
	
	@Autowired
	WmRoomMapper roomMapper;
	
	@RequestMapping(value = "/test2", method = RequestMethod.GET)
	public ModelAndView test2(HttpServletRequest request, HttpServletResponse reponse) {
		Map<String, Object> map = new HashMap<String, Object>();
		
		String view = "test2";
		
		WmRoomExample e = new WmRoomExample();
		e.createCriteria().andRoomTypeEqualTo("1");
		List<WmRoom> rooms = roomMapper.selectByExample(e);
		List<WmCatalog> catalogs = this.catalogService.getCatalogs(3);
		map.put("rooms", rooms);
		map.put("catalogs", catalogs);
		
		return new ModelAndView(view,map);
	}
	
}
